import request from '@/utils/request'

export function fetchList(data) {
  return request({
    url: '/ops/course/list',
    method: 'post',
    data
  })
}

export function getRecommendList(params) {
  return request({
    url: '/ops/course/recommendList',
    method: 'get',
    params: {tenantId: params}
  })
}

export function getArrangeList(params) {
  return request({
    url: '/ops/course/arrangeList',
    method: 'get',
    params: {tenantId: params}
  })
}

export function addTeacherToCourse(courseId, teacherIds, teacherNames) {
  return request({
    url: '/ops/course/addTeacherToCourse',
    method: 'get',
    params: {courseId: courseId, teacherIds: teacherIds, teacherNames: teacherNames}
  })
}

export function updateCourse(data) {
  return request({
    url: '/ops/course/update',
    method: 'post',
    data
  })
}

export function updateCourseStatus(data) {
  return request({
    url: '/ops/course/updateCourseStatus',
    method: 'post',
    data
  })
}

export function addCourse(data) {
  return request({
    url: '/ops/course/add',
    method: 'post',
    data
  })
}

export function deleteCourse(params) {
  return request({
    url: '/ops/course/delete',
    method: 'get',
    params: {id: params}
  })
}

export function getArrayCourseCount(params) {
  return request({
    url: '/ops/arrayCourse/getCount',
    method: 'get',
    params
  })
}

export function getBespeakCourse(params) {
  return request({
    url: '/ops/bespeakCourse/list',
    method: 'get',
    params: {tenantId: params}
  })
}

export function getTeacherDetail(params) {
  return request({
    url: '/ops/arrayCourse/findByUserId',
    method: 'get',
    params: {userId: params}
  })
}

export function getTeacherList(params) {
  return request({
    url: '/ops/bespeakCourse/teacherList',
    method: 'get',
    params: {tenantId: params}
  })
}

export function getStudentList(params) {
  return request({
    url: '/ops/userCourse/list',
    method: 'get',
    params: {tenantId: params}
  })
}

export function getStudentDetail(params) {
  return request({
    url: '/ops/userCourse/getById',
    method: 'get',
    params: {userId: params}
  })
}

export function updateUserCourse(data) {
  return request({
    url: '/ops/userCourse/update',
    method: 'post',
    data
  })
}

export function getTasks(params) {
  return request({
    url: '/ops/course/getTasks',
    method: 'get',
    params: {id: params}
  })
}

export function getStudyUser(params) {
  return request({
    url: '/ops/course/getCourseLearnDetail',
    method: 'get',
    params: {id: params}
  })
}
export function getLearningRecordsList(userId) {
  return request({
    url: '/ops/course/getLearningRecordsList',
    method: 'get',
    params: {userId: userId}
  })
}
